package com.hilon.foundation.query;
import com.hilon.foundation.para.FoundationQueryPara;
import com.hilon.foundation.util.ResultBean;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

public class QueryBaseController<T > {
    protected QueryBaseService<T> service;
    protected void setService(QueryBaseService<T> service){
        this.service=service;
    }

    @PostMapping("/submitSelectedRows/{curUser}")
    public ResultBean<String> submitSelectedRows(@RequestBody List<T> list, @PathVariable String curUser) {
        return service.submitSelectedRows(list, curUser);
    }

    @PostMapping("/queryByCondition")
    public ResultBean<List<T>> queryByCondition(@RequestBody FoundationQueryPara conditionPara) {
        return service.queryByCondition(conditionPara);
    }
    @PostMapping("/deleteById/{id}")
    public ResultBean<String> deleteById(@PathVariable Long id) {
        return service.deleteById(id);
    }
    @PostMapping("/copyById/{id}")
    public ResultBean<String> copyById(@PathVariable Long id) {
        return service.copyById(id);
    }
}
